// pages/goodsType/goodsType.js
Page({

    /**
     * 页面的初始数据
     */
    data: {
        leftMneu:[
            { url: '/assets/images/myOrder.png', title: '男装' ,clazz:'gactive' ,
                listItem: [
                    { url: '../../assets/images/tong1.png', title: 'T恤1' },
                    { url: '../../assets/images/tong2.png', title: 'T恤2' },
                    { url: '../../assets/images/tong3.png', title: 'T恤3' },
                    { url: '../../assets/images/tong1.png', title: 'T恤1' },
                    { url: '../../assets/images/tong2.png', title: 'T恤2' },
                    { url: '../../assets/images/tong3.png', title: 'T恤3' },
                    { url: '../../assets/images/tong1.png', title: 'T恤1' },
                    { url: '../../assets/images/tong2.png', title: 'T恤2' },
                    { url: '../../assets/images/tong3.png', title: 'T恤3' }
                ]
            },
            { url: '/assets/images/address.png', title: '女装', clazz: '' ,
                listItem: [
                    { url: '../../assets/images/tong3.png', title: 'T恤1' },
                    { url: '../../assets/images/tong2.png', title: 'T恤2' },
                    { url: '../../assets/images/tong1.png', title: 'T恤3' },
                    { url: '../../assets/images/tong3.png', title: 'T恤1' },
                    { url: '../../assets/images/tong1.png', title: 'T恤2' },
                    { url: '../../assets/images/tong3.png', title: 'T恤3' },
                    { url: '../../assets/images/tong3.png', title: 'T恤1' },
                    { url: '../../assets/images/tong2.png', title: 'T恤2' },
                    { url: '../../assets/images/tong1.png', title: 'T恤3' }
                ]
            },
            { url: '/assets/images/password.png', title: '鞋子', clazz: '' },
            { url: '/assets/images/problem.png', title: '帽子', clazz: '' },
            { url: '', title: '电脑办公', clazz: '' },
            { url: '', title: '手机数码', clazz: '' },
            { url: '', title: '家居生活', clazz: '' }
        ],
        item:[]
    },

    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {
        this.setData({
            item: this.data.leftMneu[0].listItem
        });
    },

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {

    },

    /**
     * 生命周期函数--监听页面显示
     */
    onShow: function () {

    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {

    },
    selectedType(e){
        //console.log(e.currentTarget.dataset.params);
        let i = e.currentTarget.dataset.params;
        this.setData({
            leftMneu: this.data.leftMneu.filter((item, index) => {
                item.clazz = i === index ? 'gactive' : '';
                return item;
            })
        });
        this.setData({
            item: this.data.leftMneu[i].listItem
        });
    }
})